<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> Xilixili </title>
</head>

<body>
    <div id='app'>
        <h1>demo5: {{title}} </h1>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <script>
        var app = new Vue({
            el: '#app',
            data: {
                title: 'xilixili - 干杯',
                message: 'Hello Vue!',
                videolist: [],
            },
            mounted() {
                this.fetch()
            },
            methods: {
                fetch() {
                    var xhr = new XMLHttpRequest()
                    xhr.open("GET", "/api/v1/video/")
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState != 4) return;
                        if (xhr.status != 200) return;
                        var data = JSON.parse(xhr.responseText);
                        this.videolist = data.xyz
                    }
                    xhr.send()
                },
            },
        })
    </script>
</body>

</html>